home *** CD-ROM | disk | FTP | other *** search
- /* p881.c --- bible */
- #include <conio.h>
- #define ESC '\033'
- static char *fieldlabel[4] =
- {"Name: ", "Street: ", "City/State/ZIP: ", "Phone: "};
- main()
- {
- int left = 20, top = 10, right = 60, bottom = 20,
- fieldxy[4][2] = {16, 3, 16, 4, 16, 5, 16, 6},
- fieldnum = 0, maxfields = 4,
- numchar = 0, c, i;
- window(left, top, right, bottom);
- textbackground(RED);
- textcolor(YELLOW);
- clrscr();
- gotoxy(10, 1);
- cputs("C L I E N T D A T A");
- gotoxy(1, bottom - top);
- cputs("<Enter> for next field, <ESC> to exit");
- for(i = 0; i < maxfields; i++)
- {
- gotoxy(1, fieldxy[i][1]);
- cputs(fieldlabel[i]);
- }
- gotoxy(fieldxy[fieldnum][0], fieldxy[fieldnum][1]);
- while((c = getch()) != ESC)
- {
- if(c == '\r')
- {
- fieldnum = (fieldnum + 1) % maxfields;
- gotoxy(fieldxy[fieldnum][0], fieldxy[fieldnum][1]);
- numchar = 0;
- }
- numchar++;
- if(numchar < (right - left - fieldxy[fieldnum][0]))
- {
- if(c != '\r')
- putch(c);
- }
- else
- putch('\007');
- }
- getch();
- }